#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
using namespace std;

class Solution {
public:
    int evalRPN(vector<string>& tokens) {
        stack<int> S;
        for(int i = 0;i<tokens.size();++i){
            if(tokens[i]!="+"&&tokens[i]!="-"&&tokens[i]!="*"&&tokens[i]!="/"){
                S.push(stoi(tokens[i]));
            }
            else{
                int A = S.top();
                S.pop();
                int B = S.top();
                S.pop();
                if(tokens[i]=="+"){
                    S.push(B+A);
                }
                else if(tokens[i]=="-"){
                    S.push(B-A);
                }
                else if(tokens[i]=="*"){
                    S.push(B*A);
                }
                else{
                    S.push(B/A);
                }
            }
        }
        return S.top();
    }
};


int main(){
    Solution S;
    vector<string> nums  = {"10","6","9","3","+","-11","*","/","*","17","+","5","+"};
    cout<<S.evalRPN(nums)<<endl;
}

